package hidra.gui;

import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;

import jmetal.metaheuristics.dfmopso.DFMOPSO;

import org.jfree.chart.ChartPanel;

public class MOPSOTempJFrame extends javax.swing.JFrame {

	private ChartPanel chartPanelExternalArchive;
	private ChartPanel chartPanelSwarm;
	private DFMOPSO dfmopso;

	public MOPSOTempJFrame(DFMOPSO mopso) {

		kit = Toolkit.getDefaultToolkit();

		initComponents();

		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension windowSize = this.getSize();
		this.setLocation(Math.max(0, (screenSize.width - windowSize.width) / 2), Math.max(0, (screenSize.height - windowSize.height) / 2));

		chartPanelExternalArchive = mopso.getChartPanelExternalArchive();
		chartPanelSwarm = mopso.getChartPanelSwarm();

		jPanel2.add( chartPanelExternalArchive, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 500) );        
		jPanel4.add( chartPanelSwarm, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 500) );

		this.setVisible(false);
	}

	// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jPanel1 = new javax.swing.JPanel();
		jPanel2 = new javax.swing.JPanel();
		jPanel3 = new javax.swing.JPanel();
		jPanel4 = new javax.swing.JPanel();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("NSGAII");
		setIconImage(frameIcon);
		setName("EA"); // NOI18N

		jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

		jPanel2.setBackground(new java.awt.Color(255, 255, 255));
		jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
		jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 500, 500));

		jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

		jPanel4.setBackground(new java.awt.Color(255, 255, 255));
		jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
		jPanel3.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 500, 500));

		org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(
				layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(layout.createSequentialGroup()
						.addContainerGap()
						.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 522, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
						.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 522, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				);
		layout.setVerticalGroup(
				layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
				.add(layout.createSequentialGroup()
						.addContainerGap()
						.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
								.add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 523, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
								.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 523, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
								.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				);

		pack();
	}// </editor-fold>//GEN-END:initComponents
	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JPanel jPanel1;
	private javax.swing.JPanel jPanel2;
	private javax.swing.JPanel jPanel3;
	private javax.swing.JPanel jPanel4;
	// End of variables declaration//GEN-END:variables
	private Toolkit kit;
	private Image frameIcon;

	public DFMOPSO getMopso() {
		return dfmopso;
	}

	public void setMopso(DFMOPSO nsga) {
		this.dfmopso = nsga;
		//	        chartPanel = mopso.getChartPanel();
	}

}
